Add signbit specification for determining whether a sign bit is set#705
Add signbit specification for determining whether a sign bit is set#705rgommers merged 3 commits intodata-apis:mainfrom
signbit specification for determining whether a sign bit is set#705Conversation
rgommers
left a comment
There was a problem hiding this comment.
LGTM overall, thanks @kgryte. One sentence I'd add to the returns section is that for negative values the result is expected to be True, and for positive values False. That won't be completely obvious otherwise to readers not familiar with the low-level details.
leofang
left a comment
There was a problem hiding this comment.
I assume input shape-preserving is an implicit assumption, given that signbit just follows other elementwise docs?
@rgommers Isn't that already covered in the special cases section? |
@leofang That is correct. We don't explicitly mention the expected output shape across the element-wise specifications, but we should probably be explicit. I can submit a follow-up PR to address this more broadly. |
No, special cases are special for a reason, and should not be needed to deduce the main behavior of a function. The text always has to make sense if you'd simply delete the special cases section. |
IMO this is splitting hairs. The main behavior is precisely as described, as the API should not be confused with the signum function. Meaning, using
|
|
It is not a big ask to add something like: "if the sign bit of a value is set, i.e. has value 1 or the value has a minus sign, the result will be False". Or add the math expression like the |
|
@rgommers I've added an extended description. |
|
Two approvals and everyone was happy with this addition, so I'll hit the green button here. |
This PR
signbitfor determining whether a sign bit is set for each floating-point number in a provided input array.+0and-0and the determining the sign ofNaN, values which are not possible outside of floating-point data types. For complex data types, users need to provide the real and imaginary components separately.